#ifndef DVMAPSCENE_H
#define DVMAPSCENE_H

#include <QGraphicsScene>
#include <QMap>
#include <QSet>
#include "dvDataTableController.h"

class QDomNodeList;
class dvRegionPolygonItem;
class QColorRampEditor;
class QGraphicsTextItem;

class dvMapScene : public QGraphicsScene
{
    Q_OBJECT
public:
    dvMapScene(QObject *parent = 0);
    dvMapScene(qreal x,qreal y,qreal width,qreal height,QObject *parent = 0);
    ~dvMapScene();

    void loadObjects(QDomNodeList *list);
    void clearScene();
    void removeItem(QGraphicsItem* item);

    void fillAllRegions(Regions *regions, Data * data, QColorRampEditor *ramp);

    void fillAllRegionsWhite();

    void setCheckedPolygon(QVariant polyId, bool check);
    void setCheckedAllPolygon(Regions *regions, Data * data, bool check);

    static QColor  getColorRGBA(const QString & name);
    static QString getColorStringRGBA(const QColor& color);

    void sendPolygonChecked(QVariant polyId, bool check);

    void exportImageFile(const QString& fname, QColorRampEditor *ramp);

    void setMapTitle(const QString& title);
    void setHiddenTitleItem(bool hide);

private:
    QSet<dvRegionPolygonItem*> m_ScenePolygons;
    QGraphicsTextItem* m_pTitleItem;
    QString m_title;

signals:
    void polygonChecked(QVariant polyId, bool check);
    
public slots:
    
};

#endif // DVMAPSCENE_H
